<template>
	<view class="tab">
		<uv-tabbar :value="index" @change="setTabBars" activeColor='#e94f06' inactiveColor='#b0b3be'>
			<uv-tabbar-item v-for="(v,k) in navList" :key="k" :text="v.title">
				<template v-slot:inactive-icon>
					<image class="tabImg" mode="aspectFit" :src="v.img"></image>
				</template>
				<template v-slot:active-icon>
					<image class="tabImg" mode="aspectFit" :src="v.isimg"></image>
				</template>
			</uv-tabbar-item>
		</uv-tabbar>
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted,
		defineProps 
	} from 'vue'
	const props = defineProps({
		index: Number
	})
	const navList = ref([
		{
			title:'首页',
			url:'/pages/index/index',
			img:'../../static/image/shouye1.png',
			isimg:'../../static/image/shouye2.png'
		},
		{
			title:'会展',
			url:'/pages/huizhan/huizhan',
			img:'../../static/image/zhanhui1.png',
			isimg:'../../static/image/zhanhui2.png'
		},
		{
			title:'通讯录',
			url:'/pages/huizhan/huizhan',
			img:'../../static/image/txl1.png',
			isimg:'../../static/image/txl2.png'
		},
		{
			title:'视频',
			url:'/pages/shipin/shipin',
			img:'../../static/image/sp1.png',
			isimg:'../../static/image/sp2.png'
		},
		{
			title:'消息',
			url:'/pages/xiaoxi/xiaoxi',
			img:'../../static/image/xx1.png',
			isimg:'../../static/image/xx2.png'
		},
		{
			title:'我的',
			url:'/pages/user/user',
			img:'../../static/image/wd1.png',
			isimg:'../../static/image/wd2.png'
		}
	])
	const setTabBars = (index)=>{
		uni.switchTab({
			url:navList.value[index].url
		})
	}
</script>
<style lang="scss" scoped>
	
	.tab{
		width: 100%;
	}
	.tabImg{
		width: 40rpx;
		height: 40rpx;
	}
</style>